package com.shujia.five;

import org.junit.Test;

import java.io.*;

public class Exer1 {

    @Test
    public void test() throws IOException {
        try (BufferedInputStream bis = new BufferedInputStream(
                new FileInputStream("file\\1_copy.jpg"));
             BufferedOutputStream bos = new BufferedOutputStream(
                     new FileOutputStream("file\\2.jpg"))) {

            int i = 5;

            int data;
            while ((data = bis.read()) != -1) {
                bos.write(data ^ i);
                bos.flush();
            }

        }
    }
}
